<template>
    <rx-dialog :isCancel="false" :isOk="false">
        <rx-layout >
            <template #middle>
              <a-form ref="form" :model="mdl">
                <a-row >
                  <a-col :span="24">
                    <a-form-item :label="i18n('form.taskName','任务名称')" name="taskName">
                      {{mdl.taskName}}
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="12">
                    <a-form-item :label="i18n('form.nodeName','节点名称')" name="nodeName">
                      {{$i18(mdl.nodeName,"节点名称")}}
                    </a-form-item>
                  </a-col>
                  <a-col :span="12">
                    <a-form-item :label="i18n('form.createByName','任务所属人')"  name="createByName">
                      {{mdl.createByName}}
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="12">
                    <a-form-item :label="i18n('form.startTime','开始时间')" name="startTime">
                      {{mdl.startTime}}
                    </a-form-item>
                  </a-col>
                  <a-col :span="12">
                    <a-form-item :label="i18n('form.endTime','结束时间')"  name="endTime">
                      {{mdl.endTime}}
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="12">
                    <a-form-item :label="i18n('form.duration','执行时长')"  name="duration">
                      {{(mdl.duration/1000).toFixed(2)+"s"}}
                    </a-form-item>
                  </a-col>
                  <a-col :span="12">
                    <a-form-item :label="i18n('form.isSuccess','执行结果')"  name="isSuccess">
                      <a-tag v-if="mdl.isSuccess" :color="statusMap[mdl.isSuccess].color">
                        <span>{{ statusMap[mdl.isSuccess].text }}</span>
                      </a-tag>
                    </a-form-item>
                  </a-col>
                </a-row>
                <a-row>
                  <a-col :span="24">
                    <a-form-item    style="width: 100%;"  :label="i18n('form.message','详细信息')" name="message">
                      <a-textarea
                          v-model:value="mdl.message"
                          :auto-size="{ minRows: 6,maxRows: 10}"
                      />
                    </a-form-item>
                  </a-col>
                </a-row>
              </a-form>
            </template>
        </rx-layout>
    </rx-dialog>
</template>
<script>
import BpmAsyncTaskApi from '@/common/api/bpm/bpmAsyncTask'
import {RxDialog, BaseFormModel} from '@lowcode/jpaas-base-lib';

export default {
    name: 'BpmAsyncTaskEdit',
    mixins: [BaseFormModel],
    components: {
        RxDialog,
    },
    data() {
        return {
            statusMap: {
                "SUCCESS": {color: 'green', text: this.i18n("list.success","成功")},
                "ERROR": {color: 'red', text: this.i18n("list.error","失败")},
                "RUNNING": {color: 'blue', text: this.i18n("list.running","运行中")},
            },
        }
    },
    methods: {
        i18n(name,text,key){
            return this.$ti18(name,text,"BpmAsyncTask",key);
        },
        get(id) {
            return BpmAsyncTaskApi.get(id);
        },
    }
}
</script>
<style>
.relick a {
    margin-right: 10px;
}

</style>
